<?php 
    require_once("include/game_core.php");
    
    require_once(DB_FILE);
    require_once(USER_CONTROLLER_FILE);
    
    $still_waiting = false; //set to true onlly if user return to this page while still waiting
    
    // CHECK IF USER LOGED IN!!!!
    // !@!@!@!
    if (UserController::isLoggedIn()) {
        if (UserController::isWatingForGame()) {    //user already waiting
            $still_waiting = true;
        }
        else {
            UserController::SetWatingForGame(1);
        }
    }
    else{
        header( 'Location: index.php' ) ;   // user NOT loggedIn - go to Index
    }
    
    require_once(VIEW_BASE_FILE);
    $view = new view_base();
    
    $view->ShowHeader();
?>
<link href="css/room.css" rel="stylesheet" type="text/css" media="all" />
<?php
    $view->ShowMenu();
    $view->ShowConatinerHead();
?>
<div id="content">

    <h2>Waiting for your opponent</h2>
    <h3>Please be patient...</h3>
    <br/>
    <table width="100%">
        <tr>
            <td class="quote_td">
                "A man who is a master of patience is master of everything else" <b>George Savile </b>
            </td>
        </tr>
        <tr>
            <td class="image_td">
                <img src="images/room/wait.jpg"/>
            </td>
        </tr>
    </table>
</div>
<?php include (VIEW_SIDE_FILE); ?>
<?php   $view->ShowFooter();      ?>